//
//  GHTabbarViewController.m
//  GodHorses
//
//  Created by Mac on 2017/11/14.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "TMTabbarViewController.h"

#import "OEHomeViewController.h"
#import "OEShareViewController.h"
#import "OEOrderViewController.h"
#import "OEMineViewController.h"
@interface TMTabbarViewController ()

@end

@implementation TMTabbarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [UITabBar appearance].translucent = NO;
    [self confiChildVC];
    self.tabBar.backgroundColor = TM_ThemeBackGroundColor;
    self.tabBar.barTintColor = TM_ThemeBackGroundColor;
    [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"Helvetica-Bold" size:11.f], NSForegroundColorAttributeName : TM_secendTextColor} forState:UIControlStateNormal];
    [[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:OE_LIMITE_COLOR} forState:UIControlStateSelected];
    

    // Do any additional setup after loading the view.
}

- (void)confiChildVC{

        [self setTabbarChildController:[OEHomeViewController new]
                             itemTitle:@"HOME"
                             itemImage:[UIImage imageNamed:@"60×52主页"]
                           selectImage:[UIImage imageNamed:@"60×52主页s"]
                               itemTag:10000];
        
        [self setTabbarChildController:[OEShareViewController new]
                             itemTitle:@"SHARE"
                             itemImage:[UIImage imageNamed:@"52×52分享"]
                           selectImage:[UIImage imageNamed:@"52×52分享s"]
                               itemTag:10001];
        [self setTabbarChildController:[OEOrderViewController new]
                             itemTitle:@"RECORDS"
                             itemImage:[UIImage imageNamed:@"52×52记录"]
                           selectImage:[UIImage imageNamed:@"52×52记录s"]
                               itemTag:10002];
        [self setTabbarChildController:[OEMineViewController new]
                             itemTitle:@"MY"
                             itemImage:[UIImage imageNamed:@"50×52我的"]
                           selectImage:[UIImage imageNamed:@"50×52我的s"]
                               itemTag:10003];


   
}

- (void)setTabbarChildController:(UIViewController *)controller itemTitle:(NSString *)title itemImage:(UIImage *)image selectImage:(UIImage *)simage itemTag:(NSInteger)tag {
    
    image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    simage = [simage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    STNavigationController *navi = [[STNavigationController alloc] initWithRootViewController:controller];
    navi.tabBarItem = [[UITabBarItem alloc] initWithTitle:title image:image selectedImage:simage];
    navi.tabBarItem.tag = tag;
    [self addChildViewController:navi];
}


@end

